<template>
	<view>
		<view class="cu-card article no-card">
			<view class="cu-item shadow borderBottom" @click="gotoDetail(item.id)">
				<view class="title">
					<view class="text-cut text-bold text-lg">{{item.title}}</view>
				</view>
				<view class="content">
					<image :src="item.coverImage" mode="scaleToFill" @error="handleErrorImg(item)"></image>
					<view class="desc">
						<view class="text-content">{{item.description}}</view>
						<view class="margin-top-xs"
							style="display: flex;align-items:center;justify-content: space-between;">
							<view class="text-gray light sm text-df round fl">{{item.updateTime}}</view>
							<view>
								<view class="text-gray light sm round margin-lr-xs"
									style="display: inline-flex;align-items:center;">
									<text class="text-gray cuIcon-attentionfill text-df"
										style="margin-right: 6rpx;"></text>
									<text class="text-df" style="margin-top: 2rpx;">{{item.lookCount}}</text>
								</view>
								<view class="text-gray light sm round margin-lr-xs"
									style="display: inline-flex;align-items:center;">
									<text class="text-gray cuIcon-appreciatefill text-df"
										style="margin-right: 6rpx;"></text>
									<text class="text-df" style="margin-top: 2rpx;">{{item.loveCount}}</text>
								</view>
								<view class="text-gray light sm round" style="display: inline-flex;align-items:center;">
									<text class="text-gray cuIcon-comment text-df" style="margin-right: 6rpx;"></text>
									<text class="text-df" style="margin-top: 2rpx;">{{item.commentCount}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "blogItem",
		props: ["item"],
		data() {
			return {

			};
		},
		methods: {
			gotoDetail(id) {
				uni.navigateTo({
					url: '/pages/list/detail?id=' + id
				})
			},
			handleErrorImg(e) {
				console.log(e)
				e.coverImage = '../../static/404.png'
			}
		}
	}
</script>

<style lang="scss">
	.borderBottom {
		border-bottom: 1px solid #f2f2f2;
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 300rpx;
			border-radius: 50%;
			margin: 0 auto;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, #1cbbb4 0%, #0081ff 100%);
		}
	}

	.nav .cu-item.cur {
		font-weight: 600;
	}
</style>